package com.superatom.innerclasses;

import com.superatom.innerclasses.controller.Event;

public class GreenhouseController {
    public static void main(String[] args){
        GreenhouseControls gc = new GreenhouseControls();

        gc.addEvent(gc.new Bell(900));
        // 使用了命令行设计模式
        Event[] eventList = {
                gc.new ThermostatNight(0),
                gc.new LighOn(200),
                gc.new LighOn(400),
                gc.new WaterOn(600),
                gc.new WaterOff(800),
                gc.new ThermostatDay(1400)
        };

        gc.addEvent(gc.new Restart(2000, eventList));

        if (args.length == 1){
            gc.addEvent(new GreenhouseControls.Terminate(new Integer(args[0])));
        }

        gc.run();
    }
}
